<script setup>
defineProps({
    control: Object,
    model: Object,
})
</script>

<template>
    <van-field
        :name="control.id"
        :label="control.props.label"
        :rules="control.rules"
        :required="control.rules[0].required"
    >
        <template #input>
            <van-checkbox-group v-model="model[control.id]" direction="horizontal">
                <van-checkbox
                    :name="item.value"
                    shape="square"
                    v-for="item in control.props.options"
                >{{ control.props.showOptionLabel ? item.label || item.value : item.value }}</van-checkbox>
            </van-checkbox-group>
        </template>
    </van-field>
</template>
